<template>
  <div>
    <div><img src="../assets/icons/logo/logo_icon.png" alt=""></div>
    <P>用户名:<span>{{ Goods[15].username }}</span></P>
    <P>账号:<span>{{ Goods[15].account }}</span></P>
    <div><van-button type="success" @click="logout">退出登录</van-button></div>
  </div>
</template>

<script>
import { inject } from 'vue';
import { showConfirmDialog } from 'vant';
export default {
    setup(){
        //退出登录
        const Goods = inject('Goods')
        let LoginIndex = inject('LoginIndex')
        let RegisterImformation = inject('RegisterImformation')
        function logout(){
            showConfirmDialog({
            confirmButtonColor:'#27ba9b',
            message:
                '确认要退出登录吗？',
            })
            .then(() => {
                RegisterImformation[LoginIndex.value].cart = Goods[14]
                Goods[15] = []
                Goods[14] = []
                LoginIndex.value = null
                localStorage.setItem('Register',JSON.stringify(RegisterImformation))
            })
            .catch(() => {
                // on cancel
            });
        }
        return {Goods,logout}
    }
}
</script>

<style scoped>
button{
    width: 100px;
    background-color: #28ba9b;
}
span{
    margin: 0 0 20px 10px;
    color: #2c3e50;
}
p{
    color: #28ba9b;
}
img{
    width: 60px;
    margin: 0 0 20px;
}
</style>